"""
Author: Faye Lee
Date: 2025-04-12 11:49:26
LastEditTime: 2025-05-09 11:37:59
LastEditors: Faye Lee
Description:
FilePath: \pygame_alien\settings.py
Halo Baby,欢迎打开新世界的大门!
"""


class Settings:
    """存储外星人入侵的所有设置的类"""

    def __init__(self):
        """初始化游戏的静态设置"""
        # 屏幕设置
        self.screen_width = 1200
        self.screen_height = 800
        self.bg_color = (245, 245, 245)  # RGB颜色值
        # FPS设置最大值
        self.fps = 72

        # 飞船设置
        self.ship_width = 80
        self.ship_limit = 3

        # 外星人设置
        # 外星人宽度
        self.alien_width = 60
        # 外星人间距参数
        self.alien_space_factor = 5 / 6

        # 子弹设置
        # 子弹宽度
        self.bullet_width = 3
        # 子弹高度
        self.bullet_height = 15
        # 子弹颜色
        self.bullet_color = (60, 60, 60)
        # 允许的最大子弹数量
        self.bullets_allowed = 4

        # 加快游戏节奏的速度
        self.speedup_scale = 1.2

        # 显示得分信息时使用的字体设置
        self.score_text_color = (30, 30, 30)
        self.high_text_color = (249, 90, 90)
        self.top_font_path = "font/msyh.ttc"
        self.top_font_size = 14 

        # 按钮字体颜色设置
        self.button_color = (239, 150, 97)
        self.button_text_color = (255, 255, 255)
        self.button_font_path = "font/msyh.ttc"
        self.button_font_size = 24
        self.initialize_dynamic_settings()

    def initialize_dynamic_settings(self):
        """初始化随游戏进行而变化的设置"""
        # 飞船速度
        self.ship_speed_factor = 5.4
        # 子弹速度
        self.bullet_speed_factor = 8.4
        # 外星人移动速度
        self.alien_speed_factor = 2
        # 外星人下落速度
        self.alien_drop_speed = 8

        # 外星人移动方向 1为向右 -1为向左
        self.fleet_direction = 1

        # 记分
        self.alien_points = 7

    def increase_speed(self):
        """提高速度设置"""
        # 提高速度设置
        self.speedup_scale += 0.1
        self.ship_speed_factor *= self.speedup_scale
        self.bullet_speed_factor *= self.speedup_scale
        self.alien_speed_factor *= self.speedup_scale
        self.alien_drop_speed *= 1.2
        # 提高外星人点数
        self.alien_points = self.alien_points * self.speedup_scale
